<template>

  <el-container style="height: 750px; border: 1px solid #eee;background-color: white">
    <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
      <h5>菜单栏</h5>
      <el-menu
          default-active="$route.path"
          class="el-menu-vertical-demo"

          router>
          <!-- v-if="isAdmin===true" -->
        <!-- <el-menu-item index="1" route="/allMessages?nClass=新闻" v-if="isAdmin===true"> -->
          <el-menu-item index="1" route="/allMessages?nClass=节气" >

          <i class="el-icon-menu"></i>
          <span slot="title">文章管理</span>
        </el-menu-item>

        <!-- v-if="isAdmin" -->
        <!-- <el-menu-item index="3" route="/category"  >
          <i class="el-icon-location"></i>
          <span slot="title">线名管理</span>
        </el-menu-item> -->

        <!-- <el-menu-item index="4" route="/publicWorksSection" v-if="isAdmin"> -->
          <!-- <el-menu-item index="4" route="/publicWorksSection" >

          <i class="el-icon-s-order"></i>
          <span slot="title">工务段管理</span>
        </el-menu-item> -->

        <el-menu-item index="5" route="/filemanage">
          <i class="el-icon-document"></i>
          <span slot="title">文件管理</span>
        </el-menu-item>

        <!-- <el-menu-item index="10" route="/userList">
          <i class="el-icon-document"></i>
          <span slot="title">员工管理</span>
        </el-menu-item> -->

        <el-menu-item index="6" route="/userList">
          <i class="el-icon-user-solid"></i>
          <span slot="title">用户管理</span>
        </el-menu-item>

<!--        <el-menu-item index="7" route="/description">-->
<!--          <i class="el-icon-setting"></i>-->
<!--          <span slot="title">系统说明</span>-->
<!--        </el-menu-item>-->

        <el-menu-item index="8" route="/" @click="clearToken">
          <i class="el-icon-setting"></i>
          <span slot="title">退出管理</span>
        </el-menu-item>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header style="text-align: right;
    font-size: 15px;
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;">
        <span>{{ who }} 欢迎您！</span>
      </el-header>

      <el-main style="padding: 0;">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>


</template>

<script>
// import AddTextComponent from "../components/editorVue.vue"
export default {
  name: "AdminComponent",
  data() {
    return {
      isAdmin: window.localStorage.getItem('power') === '系统管理员',
      who: window.localStorage.getItem('ms_username'),
    }
  },
  methods: {
    // this.$confirm("此操作永久删除当前信息，是否继续？", "提示", {type: "info"}).then(() => {
    //   this.$axios.post("/user/deleteUser?idList=" + row.id).then((res) => {
    //     if (res.data.code === 200) {
    //       this.$message.success("删除成功");
    //     } else if (res.data.code === 401) {
    //       this.$message.error("无权限！");
    //     } else {
    //       this.$message.error("数据同步失败，自动刷新");
    //     }
    //   }).finally(() => {
    //     //2.重新加载数据
    //     this.getAll();
    //   });
    // }).catch(() => {
    //   this.$message.info("取消操作");
    // });

    clearToken() {
      // this.$confirm("即将退回登录，是否继续？", "提示", {type: "info"}).then(() => {
        this.$store.commit('$_removeStorage');    // 清除登录信息
        localStorage.removeItem('power')
      // }).catch(() => {
      //   this.$message.info("取消操作");
      // });
    }
  },
  mounted() {
    // this.who=window.localStorage.getItem('ms_username');
  }
}
</script>
<style>
/*  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }*/

.el-aside {
  color: #333;
}
</style>

